package cn.jbolt.admin.xd.xdscmsupplier;

import cn.jbolt.core.service.base.JBoltBaseService;
import cn.jbolt.core.api.httpmethod.JBoltHttpGet;
import cn.jbolt.core.api.httpmethod.JBoltHttpPost;
import cn.jbolt.core.api.HttpMethod;
import cn.jbolt.core.api.httpmethod.JBoltHttpMethod;
import cn.jbolt.core.model.base.JBoltBaseModel;
import com.jfinal.aop.Inject;
import cn.jbolt.core.api.JBoltApiBaseController;
import cn.jbolt.core.permission.CheckPermission;
import cn.jbolt.extend.permission.PermissionKey;
import cn.jbolt.core.permission.UnCheckIfSystemAdmin;
import com.jfinal.core.Path;
import com.jfinal.aop.Before;
import com.jfinal.core.paragetter.Para;
import com.jfinal.plugin.activerecord.tx.Tx;
import com.jfinal.plugin.activerecord.tx.TxConfig;
import cn.jbolt.core.base.JBoltMsg;
import cn.jbolt.common.model.xd.XdScmSupplier;
/**
 * null管理
 * @ClassName: XdScmSupplierAdminController
 * @author: wzx
 * @date: 2025-07-13 00:51
 */
@CheckPermission(PermissionKey.XD_SCM_SUPPLIER)
@UnCheckIfSystemAdmin
@Path("/api/admin/xdScmSupplier")
public class XdScmSupplierAdminController extends JBoltApiBaseController {

	@Inject
	private XdScmSupplierService service;
	@Override
    protected JBoltBaseService<? extends JBoltBaseModel<?>> getModelService() {
        return service;
    }
   /**
    * 单个详情
    */
   @JBoltHttpGet
   public void index() {
       renderJBoltApiRet(findModelById());
   }

   /**
   	 * 数据查询接口
   	 * @param page       第几页
   	 * @param pageSize   每页几条数据
   	 * @param keywords   关键词
   	 * @param sortColumn 排序列名
   	 * @param sortType   排序方式 asc desc
     * @param type 类型
     * @param isDeleted 是否删除
   	 */
	@JBoltHttpMethod({HttpMethod.GET,HttpMethod.POST})
	public void datas(@Para(value = PAGE_PARAM_NAME,defaultValue = "1")Integer page,
    @Para(value = PAGESIZE_PARAM_NAME,defaultValue = "15")Integer pageSize,
        @Para(KEYWORDS_PARAM_NAME)String keywords,
        @Para(value = "sortColumn",defaultValue = "id")String sortColumn,
        @Para(value = "sortType",defaultValue = "desc")String sortType,
        @Para("type")Integer type,
@Para(value = IS_DELETED_PARAM_NAME,defaultValue = "false")Boolean isDeleted) {
		renderJBoltApiSuccessWithData(service.getAdminDatas(page,pageSize,keywords,sortColumn,sortType,type,isDeleted));
	}

   /**
	* 保存
	*/
	@Before(Tx.class)
	@JBoltHttpPost
	public void save(@Para("")XdScmSupplier xdScmSupplier) {
		renderJBoltApiRet(service.save(xdScmSupplier));
	}

   /**
	* 更新
	*/
	@Before(Tx.class)
    @JBoltHttpPost
	public void update(@Para("")XdScmSupplier xdScmSupplier) {
		renderJBoltApiRet(service.update(xdScmSupplier));
	}

   /**
	* 批量删除
	*/
    @Before(Tx.class)
    @JBoltHttpGet
	public void deleteByIds() {
        renderJBoltApiRet(deleteModelByIds());
	}

   /**
	* 删除
	*/
	@Before(Tx.class)
    @JBoltHttpGet
	public void delete() {
	    renderJBoltApiRet(deleteModelById());
	}

   /**
	* 恢复假删数据
	*/
    @Before(Tx.class)
    @JBoltHttpGet
	public void recover() {
        renderJBoltApiRet(recoverModelById());
	}

   /**
	* real delete 真删除
	*/
    @Before(Tx.class)
    @JBoltHttpGet
	public void realDelete() {
        renderJBoltApiRet(realDeleteModelById());
	}


}
